---
title: "Predictions_females_ecv"
author: "Smith"
date: "2025-01-08"
output: html_document
---

```{r}

##cargar Norpred

source("nordpred.s")

```


```{r warning=FALSE, message=FALSE}

#cargar archivos

indata <- read.table("Colombia_obitos.txt", header =T,sep=",",row.names=1)
inpop1 <- read.table("Colombia_observed_lungcancer.txt", header =T,sep=",",row.names=1)
inpop2 <- read.table("Colombia_predictions_lungcancer.txt",header =T,sep=",",row.names=1)


```



```{r}
# Include possible population predictions

inpop <- cbind(inpop1,inpop2)

```



```{r}
##starstage 5, ya que empieza aqui la mortalidad

est <-  nordpred.estimate(cases=indata,pyr=inpop,noperiod=3,startestage=6)

```




```{r}
# Fit model using poisson link: 

est2 <- nordpred.estimate(indata,inpop,3,6,linkfunc="poisson")
```


```{r}
# Print results: 
print(est) 
print(est$glm) 
```



```{r}
# Use estimat object to make predictions: 


res <- 
  nordpred.prediction(est,startuseage=6,cuttrend=c(0, 0.25, 0.5, 0.75, 0.75),recent=T) 
```


```{r}
# Predictions cases 

est <- nordpred.estimate(cases=indata,pyr=inpop,noperiod=3,startestage=6) 

```



```{r}
# Print / get results ### # de muertes por año y predicciones 
# Puedo sumar grupos etarios o tomar el grupo etario que desee

print(res) 
```





```{r}

# Get results with standardisation: 

wstand <- c(0.12, 0.1, 0.09, 0.09, 0.08, 0.08, 0.06, 0.06, 0.06, 
            0.06,0.05, 
            0.04, 0.04, 0.03, 0.02, 0.01, 0.005, 0.005) 

round(nordpred.getpred(res,incidence=T,standpop=NULL),2) 
round(nordpred.getpred(res,incidence=T,standpop=wstand),2) 
```



```{r}
# summary results 
est <- summary(res,printpred=F)
```





